import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
function resolveFun(dir) {
  return path.join(__dirname, dir)
}
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: "0.0.0.0",
    cors: true,
    open: false,//启动项目自动弹出浏览器
    proxy:{
      "api": {
        target: 'https://www.jxdkchy.com:30338/jeecg-boot/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },
  resolve: {
    //配置别名
    alias: {
      '@': '/src',
      '@assets': resolveFun('src/assets')
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        modifyVars: {
          'primary-color': '#0060bd',
          'link-color': '#0060bd',
          'border-radius-base': '6px',
        },
        javascriptEnabled: true //开启less编译
      }
    }
  }
})
